package game.buildings;

import game.resources.*;

/**
 *	@(#)Farm.java
 *
 *	The <code>Farm</code> class represents the farm building.
 *	A farm is a producer and provides grain, olives, sheep or wine.
 *
 *	@author Grzegorz Kobiela
 *	@version 1.0 2008/4/23
 */
public final class Farm
extends Producer
{
	/**
	 *	Creates a new <code>Farm</code> instance.
	 */
	public Farm() {
		super(BuildingType.FARM);
	}

	/**
	 *	Adds the given resource to the list of resources.
	 *	@param resource the resource
	 */
	@Override
	public void addResource(Resource resource) {
		if(resource instanceof Grain || resource instanceof Olives || resource instanceof Sheep || resource instanceof Wine) {
			super.addResource(resource);
		} else {
			throw new IllegalArgumentException("Fishermen do not produce " + resource + "!");
		}
	}
}